package com.itgacl.fastdfs;

import java.util.ResourceBundle;

/**
 * Created by gacl on 2017/10/17.
 */
public class FastDFSClientConfig {

    public static String PROTOCOL = "http://";
    public static String SEPARATOR = "/";
    public static String COLON = ":";
    public static String TRACKER_NGNIX_PORT = "80";

    private static ResourceBundle fdfsClientConfigResourceBundle;
    public static String FASTDFS_CLIENT_CONFIG_FILE;
    // Initialize Fast DFS Client configurations
    public static void init(String fastdfsClientInitPropsFilePath){
        FASTDFS_CLIENT_CONFIG_FILE = fastdfsClientInitPropsFilePath;
        String baseName = fastdfsClientInitPropsFilePath.substring(0, fastdfsClientInitPropsFilePath.lastIndexOf("."));
        fdfsClientConfigResourceBundle = ResourceBundle.getBundle(baseName);
    }

    /**
     * FastDFS相关配置
     */
   public static class FastDFS{
        /**
         * FastDFS Http服务器
         */
        public static String FASTDFS_HTTP_SERVER = fdfsClientConfigResourceBundle.getString("fastdfs.http_server");
        public static long FASTDFS_MAX_POOL_SIZE = Long.parseLong(fdfsClientConfigResourceBundle.getString("fastdfs.max_pool_size"));
        public static long FASTDFS_MIN_POOL_SIZE = Long.parseLong(fdfsClientConfigResourceBundle.getString("fastdfs.min_pool_size"));
        public static long FASTDFS_WAIT_TIMES = Long.parseLong(fdfsClientConfigResourceBundle.getString("fastdfs.wait_times"));
    }


}
